<?php
/**
 * ValidateHelper
 *
 * @author fusq
 */
class ValidateHelper {

	public static function validateInt(){
		$va1 = new Zend_Validate_Int();
		$va1->setMessage("'%value%' does not appear to be an integer",Zend_Validate_Int::NOT_INT);
		return $va1;
	}
	public static function validateAlnum(){
		$alnum = new Zend_Validate_Alnum();
		$alnum->setMessage("'%value%' has not only alphabetic and digit characters",Zend_Validate_Alnum::NOT_ALNUM);
		$alnum->setMessage("'%value%' is an empty string",Zend_Validate_Alnum::STRING_EMPTY);
		return $alnum;
	}
	public static function validateAlpha(){
		$alpha = new Zend_Validate_Alpha();
		$alpha->setMessage("'%value%' has not only alphabetic characters",Zend_Validate_Alpha::NOT_ALPHA);
		$alpha->setMessage("'%value%' is an empty string",Zend_Validate_Alpha::STRING_EMPTY);
		return $alpha;
	}
	public static function Zend_Validate_Between(){
		$Between = new Zend_Validate_Between();
		$Between->setMessage("'%value%' is not between '%min%' and '%max%', inclusively",Zend_Validate_Between::NOT_BETWEEN);
		$Between->setMessage("'%value%' is not strictly between '%min%' and '%max%'",Zend_Validate_Between::NOT_BETWEEN_STRICT);
		return $Between;
	}
	public static function validateCcnum(){
		$ccnum = new Zend_Validate_Ccnum();
		$ccnum->setMessage("'%value%' must contain between 13 and 19 digits",Zend_Validate_Ccnum::LENGTH);
		$ccnum->setMessage("Luhn algorithm (mod-10 checksum) failed on '%value%'",Zend_Validate_Ccnum::CHECKSUM);
		return $ccnum;
	}
	public static function validateDate(){
		$date = new Zend_Validate_Date();
		$date->setMessage("'%value%' is not of the format YYYY-MM-DD",Zend_Validate_Date::NOT_YYYY_MM_DD);
		$date->setMessage("'%value%' does not appear to be a valid date",Zend_Validate_Date::INVALID);
		$date->setMessage("'%value%' does not fit given date format",Zend_Validate_Date::FALSEFORMAT);
		return $date;
	}
	public static function validateDigits(){
		$digits = new Zend_Validate_Digits();
		$digits->setMessage("'%value%' contains not only digit characters",Zend_Validate_Digits::NOT_DIGITS);
		$digits->setMessage("'%value%' is an empty string",Zend_Validate_Digits::STRING_EMPTY);
		return $digits;
	}
	public static function Zend_Validate_EmailAddress(){
		$email = new Zend_Validate_EmailAddress();
		$email->setMessage("'%value%' is not a valid email address in the basic format local-part@hostname",Zend_Validate_EmailAddress::INVALID);
		$email->setMessage("'%hostname%' is not a valid hostname for email address '%value%'",Zend_Validate_EmailAddress::INVALID_HOSTNAME);
		$email->setMessage("'%hostname%' does not appear to have a valid MX record for the email address '%value%'",Zend_Validate_EmailAddress::INVALID_MX_RECORD);
		$email->setMessage("'%localPart%' not matched against dot-atom format",Zend_Validate_EmailAddress::DOT_ATOM);
		$email->setMessage("'%localPart%' not matched against quoted-string format",Zend_Validate_EmailAddress::QUOTED_STRING);
		$email->setMessage("'%localPart%' is not a valid local part for email address '%value%'",Zend_Validate_EmailAddress::INVALID_LOCAL_PART);
		$email->setMessage("'%value%' exceeds the allowed length",Zend_Validate_EmailAddress::LENGTH_EXCEEDED);
		return $email;
	}
	public static function Zend_Validate_Float(){
		$float = new Zend_Validate_Float();
		$float->setMessage("'%value%' does not appear to be a float",Zend_Validate_Float::NOT_FLOAT);
		return $float;
	}
	public static function Zend_Validate_GreaterThan(){
		$GreaterThan = new Zend_Validate_GreaterThan();
		$GreaterThan->setMessage("'%value%' is not greater than '%min%'",Zend_Validate_GreaterThan::NOT_GREATER);
		return $GreaterThan;
	}
	public static function Zend_Validate_Hex(){
		$Hex = new Zend_Validate_Hex();
		$Hex->setMessage("'%value%' has not only hexadecimal digit characters",Zend_Validate_Hex::NOT_HEX);
		return $Hex;
	}
	public static function Zend_Validate_Hostname(){
		$Hostname = new Zend_Validate_Hostname();
		$Hostname->setMessage("'%value%' appears to be an IP address, but IP addresses are not allowed",Zend_Validate_Hostname::IP_ADDRESS_NOT_ALLOWED);
		$Hostname->setMessage("'%value%' appears to be a DNS hostname but cannot match TLD against known list",Zend_Validate_Hostname::UNKNOWN_TLD);
		$Hostname->setMessage("'%value%' appears to be a DNS hostname but contains a dash (-) in an invalid position",Zend_Validate_Hostname::INVALID_DASH);
		$Hostname->setMessage("'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'",Zend_Validate_Hostname::INVALID_HOSTNAME_SCHEMA);
		$Hostname->setMessage("'%value%' appears to be a DNS hostname but cannot extract TLD part",Zend_Validate_Hostname::UNDECIPHERABLE_TLD);
		$Hostname->setMessage("'%value%' does not match the expected structure for a DNS hostname",Zend_Validate_Hostname::INVALID_HOSTNAME);
		$Hostname->setMessage("'%value%' does not appear to be a valid local network name",Zend_Validate_Hostname::INVALID_LOCAL_NAME);
		$Hostname->setMessage("'%value%' appears to be a local network name but local network names are not allowed",Zend_Validate_Hostname::LOCAL_NAME_NOT_ALLOWED);
		return $Hostname;
	}
	public static function Zend_Validate_Identical(){
		$Identical = new Zend_Validate_Identical();
		$Identical->setMessage("Tokens do not match",Zend_Validate_Identical::NOT_SAME);
		$Identical->setMessage("No token was provided to match against",Zend_Validate_Identical::MISSING_TOKEN);
		return $Identical;
	}
	public static function Zend_Validate_InArray(){
		$InArray = new Zend_Validate_InArray();
		$InArray->setMessage("'%value%' was not found in the haystack",Zend_Validate_InArray::NOT_IN_ARRAY);
		return $InArray;
	}
	public static function Zend_Validate_Ip(){
		$Ip = new Zend_Validate_Ip();
		$Ip->setMessage("'%value%' does not appear to be a valid IP address",Zend_Validate_Ip::NOT_IP_ADDRESS);
		return $Ip;
	}
	public static function Zend_Validate_LessThan(){
		$LessThan = new Zend_Validate_LessThan();
		$LessThan->setMessage("'%value%' is not less than '%max%'",Zend_Validate_LessThan::NOT_LESS);
		return $LessThan;
	}
	public static function Zend_Validate_NotEmpty(){
		$NotEmpty = new Zend_Validate_NotEmpty();
		$NotEmpty->setMessage("Value is required and can't be empty",Zend_Validate_NotEmpty::IS_EMPTY);
		return $NotEmpty;
	}
	public static function Zend_Validate_Regex(){
		$Regex = new Zend_Validate_Regex();
		$Regex->setMessage("'%value%' does not match against pattern '%pattern%'",Zend_Validate_Regex::NOT_MATCH);
		return $Regex;
	}
	public static function Zend_Validate_StringLength(){
		$StringLength = new Zend_Validate_StringLength();
		$StringLength->setMessage("'%value%' is less than %min% characters long",Zend_Validate_StringLength::TOO_SHORT);
		$StringLength->setMessage("'%value%' is greater than %max% characters long",Zend_Validate_StringLength::TOO_LONG);
		return $StringLength;
	}
}
?>
